package com.jpa.table.per.concrete.klass.strategy.mapping.tutorial.domain;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;

@Entity
@Table(name = "cd_releases")
@AttributeOverrides({
		@AttributeOverride(name = "id", column = @Column(name = "cd_release_id")),
		@AttributeOverride(name = "name", column = @Column(name = "cd_release_name")),
		@AttributeOverride(name = "year", column = @Column(name = "cd_release_year")),
		@AttributeOverride(name = "length", column = @Column(name = "cd_release_length")),
		@AttributeOverride(name = "numberOfTracks", column = @Column(name = "cd_release_number_of_tracks"))
})
public class CDRelease extends AudioRelease {

	@Column(name = "cd_release_type")
	@Enumerated(EnumType.STRING)
	private CDReleaseType type;

	public CDRelease() {

	}

	public CDRelease(int id, String name, int year, String length, int numberOfTracks, CDReleaseType type) {
		super();
		this.type = type;
	}

	public CDReleaseType getType() {
		return type;
	}

	public void setType(CDReleaseType type) {
		this.type = type;
	}

	@Override
	public String toString() {
		return "CDRelease{" +
				"id=" + getId() +
				", name='" + getName() + '\'' +
				", year=" + getYear() +
				", length='" + getLength() + '\'' +
				", numberOfTracks=" + getNumberOfTracks() +
				", type=" + type +
				'}';
	}
}
